;======================================================================
;按键处理
FC_Gamepad_Process
    LDX #01
FC_Gamepad_Process.Get_Gamepad_State
    JSR FC_Gamepad_Process.Gamepad_Scan
    LDA FC_Gamepad_Keep,X
    STA FC_Gamepad_Temp,X
    JSR FC_Gamepad_Process.Gamepad_Scan
    LDA FC_Gamepad_Keep,X
    CMP FC_Gamepad_Temp,X
    BEQ FC_Gamepad_Process.Gamepad_Check_Value
    LDA FC_Gamepad_Buf,X
    STA FC_Gamepad_Keep,X
FC_Gamepad_Process.Gamepad_Check_Value
    TAY
    EOR FC_Gamepad_Buf,X
    AND FC_Gamepad_Keep,X
    STA FC_Gamepad_Once,X
    STY FC_Gamepad_Buf,X
    DEX
    BPL FC_Gamepad_Process.Get_Gamepad_State
    RTS
FC_Gamepad_Process.Gamepad_Scan;按键扫描
    LDY #$01
    STY JOY1_FRAME
    DEY
    STY JOY1_FRAME
    LDY #$08
FC_Gamepad_Process.Scan_Value;扫描键值
    LDA JOY1_FRAME,X
    STA FC_Gamepad_Status,X
    LSR
    ORA FC_Gamepad_Status,X
    LSR
    ROL FC_Gamepad_Keep,X
    DEY
    BNE FC_Gamepad_Process.Scan_Value
    RTS

;======================================================================
;按键连发处理
FC_Gamepad_Turbo_Process
    LDX #01
FC_Gamepad_Turbo_Process.Get_Gamepad_State
    LDA <FC_Gamepad_Keep,X
    BEQ FC_Gamepad_Turbo_Process.Clear_Turbo_State
    AND #JOY_KEY_START
    BNE FC_Gamepad_Turbo_Process.End
    INC <FC_Gamepad_Ready_Turbo,X
    LDA <FC_Gamepad_Ready_Turbo,X
    CMP #JOY_TURBO_TIME + JOY_TURBO_INTERVAL
    BCC FC_Gamepad_Turbo_Process.End
    LDA <FC_Gamepad_Keep,X
    STA <FC_Gamepad_Once,X
    LDA #JOY_TURBO_TIME
    STA <FC_Gamepad_Ready_Turbo,X
    BNE FC_Gamepad_Turbo_Process.End
FC_Gamepad_Turbo_Process.Clear_Turbo_State
    LDA #$00
    STA <FC_Gamepad_Ready_Turbo,X
FC_Gamepad_Turbo_Process.End
    DEX
    BPL FC_Gamepad_Turbo_Process.Get_Gamepad_State
    RTS
